Robert Lewandowski scored a brilliant injury-time winner as Bayern Munich came from behind to beat Freiburg in the opening Bundesliga match of 2017.